<?php
//$intOrderHeaderID = 18;
if (defined("SITE")){
	$strSite = SITE;
	//$strSite.sprintf("%08d",$intOrderHeaderID)
}
include (MODULE_SHOP_HOST . "/navigation/EmailHeader");
include (MODULE . "/action/qrySelectOrderHeader");
$intOrderCarriage = $myrow["Freight"];
unset($intTotal);
//STYLE='table-layout: fixed'
echo  "<link REL=stylesheet HREF='http://$SERVER_NAME/shop.css'>
	<table width='600' height='1000' align='center' class='Normal' border='0'  bgcolor='White'>
<tr align='left' valign='top'>
		<td colspan='6'  width='600' height='100'><img src='http://".$SERVER_NAME."/images".SITE_SUFFIX."/EmailHeader.jpg' width='600' align='top' border='0'/></td>
	</tr>
	<tr>
		<td colspan='7' align='center'  height='70'>
			<br/><h3>THIS SHEET FOR INTERNAL USE ONLY<br/>DO NOT SEND TO CUSTOMER</h3>
			<h1 class='orderheading'>Picking List</h1>
			<h3><font color='Red'>".date("d/m/Y H:i")."</font></h3>
		</td>
	</tr>
	<tr>
		<td colspan='4' align='left' class='Normal' height='40'>
			<b>Order Number:</b> <font size='+1'>".$strSite.sprintf("%08d",$intOrderHeaderID)."</font>
		</td>
		<td colspan='3' align='right'  height='40'>
			<b>Order Date:</b> ".ReformatFromMySqlDate($myrow["OrderDate"])."
		</td>
	</tr>";
/*
	<tr>
		<td colspan='3' valign='top'  height='170'>
			<br/><b>Invoice to:</b>
			<br/>".$myrow["ShipName"]."
			<br/>".$myrow["ShipAddress"];

				if ($myrow["ShipAddress2"]){
					echo "<br/>".$myrow["ShipAddress2"];
				}
		
echo "
			<br/>".$myrow["ShipCity"]."
			<br/>".$myrow["ShipRegion"]."
			<br/>".$myrow["ShipPostalCode"]."
		</td>

		<td colspan='3' valign='top'>
			<br/><b>Deliver to:</b>
			<br/>".$myrow["DeliveryName"]."
			<br/>".$myrow["DeliveryAddress"];

				if ($myrow["DeliveryAddress2"]){
					echo "<br/>".$myrow["DeliveryAddress2"];
				}
		
echo "
			<br/>".$myrow["DeliveryCity"]."
			<br/>".$myrow["DeliveryRegion"]."
			<br/>".$myrow["DeliveryPostalCode"]."
		</td>
	</tr>
*/

echo "
	<tr>
		<td colspan='7' align='left'  height='20'>
";
			if(EXTRA_ORDER_FIELD){
				echo "<br/><b>".EXTRA_ORDER_FIELD."</b>".$myrow["OtherInfo"]."<br/>";
			}
echo "
		</td>
	</tr>
	
	<tr align='center' height='20'>
		<td align='center' width='60'>&nbsp;</td>
		<td align='left' width='190'><b>Product</b></td>
		<td align='center' width='30'><b>qty</b></td>
		<td align='center' width='140'><b>Supplier</b></td>
		<td align='center' width='80'><b>Supplier Code</b></td>
		<td align='center' width='55'><b>Unit Price</b><br/>";
		
			if($SHOP_TYPE == "Trade"){
				echo "(ex VAT)";
			}else{
				echo "(inc VAT)";
			}
echo "
		</td>
		<td align='center' width='55'><b>Total Price</b><br/>";
		
			if($SHOP_TYPE == "Trade"){
				echo "(ex VAT)";
			}else{
				echo "(inc VAT)";
			}
echo "</td>
    </tr>";
	
	include (MODULE . "/action/qrySelectOrderDetails$SHOP_TYPE");
	do{		  
		$strBackgroundImage = "";	
		$strPromotional = "";
			if($myrow["PromotionalItem"] == "1"){
				// $strBackgroundImage = "background='./images/PromotionalItem.jpg'";	
				 $strPromotional = $strPromotionalFlag;
			}else{
			  $strPromotional = "";
			}
		 
		echo "
		<tr align='right' bgcolor=\"".switch_background($boBG)."\">
			<td align='center' width='60'>";
				
				if((!$myrow["UploadedPicture"])||($myrow["UploadedPicture"]=="none")){
					echo "&nbsp;";					
				}else{
					echo "<img src='./images".SITE_SUFFIX."/product/thumbz/".$myrow["UploadedPicture"]."' border='0' alt='".$myrow["ProductName"]."' width='60' align='middle'>";
           	    }
		echo "
			</td>
			
	 		<td align='left' height='20' $strBackgroundImage>
				<span class='Small'>".$myrow["QuantityPerUnit"]."&nbsp;".$myrow["Product"].$strPromotional;
					if($myrow["Colour"]){
						echo "<br/>Colour: ".$myrow["Colour"];
					}
								
					if($myrow["Size"]){
						echo "<br/>Size: ".$myrow["Size"];
					}
				echo "</span>
			</td>
			<td>".$myrow["Quantity"]."</td>
			<td >".$myrow["SupplierName"]."</td>
			<td>";
				
				if(!$myrow["UploadedPicture"]){
					echo "&nbsp;";					
				}else{
	        		echo $myrow["SupplierProductID"];
				}
		echo "
			</td>
			<td>".CURRENCY.number_format($myrow["UnitPrice"], 2, '.', '')."</td>
			<td>".CURRENCY.number_format($myrow["UnitPrice"]*$myrow["Quantity"], 2, '.', '')."</td>
	    </tr>";
		$boBG = -1 - $boBG; //alternate $boBG values from -1 and 0
		$intTotal = number_format($intTotal + $myrow["Amount"], 2, '.', '');
		$intVatPayableTotal = number_format($intVatPayableTotal + $myrow["VatPayable"], 2, '.', '');
		$intNetTotalTotal = number_format($intNetTotalTotal + $myrow["NetTotal"], 2, '.', '');
		$intVATRate = $myrow["VatRate"];
	} while ($myrow = mysql_fetch_array($result));
	
echo "<tr height='20'>
		<td>&nbsp;</td>
        <td colspan='3' align='left' >Carriage</td>";
		
		
			if ($intOrderCarriage !== "0.00"){
					if($SHOP_TYPE == "Trade"){
						$intNetCarriage = number_format($intOrderCarriage, 2, '.', '');
						$intVATCarriage = number_format(($intOrderCarriage * ($intVATRate/100)), 2, '.', '');
						$intTotalCarriage = number_format(($intOrderCarriage + $intVATCarriage), 2, '.', '');
						$intTotal = $intTotal + $intTotalCarriage;
						echo "	
						<td align='right'>&nbsp;</td>
						<td align='right'>".CURRENCY.number_format($intNetCarriage, 2, '.', '')."</td>
						<td align='right'>".CURRENCY.number_format($intNetCarriage, 2, '.', '')."</td>";
					
					
					}else{
						$intNetCarriage = number_format($intOrderCarriage / (($intVATRate/100)+1), 2, '.', '');
						$intVATCarriage = number_format(($intOrderCarriage - ($intOrderCarriage / (($intVATRate/100)+1))), 2, '.', '');
						$intTotalCarriage = number_format($intOrderCarriage, 2, '.', '');
						$intTotal = $intTotal + $intTotalCarriage;
						echo "	
						<td align='right'>".CURRENCY.number_format($intNetCarriage, 2, '.', '')."</td>
						<td align='right'>".CURRENCY.number_format($intVATCarriage, 2, '.', '')."</td>
						<td align='right'>".number_format($intTotalCarriage, 2, '.', '')."</td>";
					}
					
				
			}else{
				$intNetCarriage = '0';
				$intVATCarriage = '0';
				 echo "<td colspan='7' align='right' class='Small'>Included</td>";
			}
		
	
	echo "
    </tr>
	
	<tr  class='Normal'>
		<td colspan='7' align='right' class='Small'><HR></td>
	</tr>
	
	<tr  class='Normal'>
		<td>&nbsp;</td>
		<td colspan='3'  height='20'>&nbsp;</td>
		<td height='20'>ex Vat</td>
 		<td height='20'>VAT</td>
		<td align='right'><b>Total</b></td>
    </tr>
	
	<tr  class='Normal'>
		<td colspan='4'>&nbsp;</td>
		<td height='20'><b>".CURRENCY.number_format($intNetTotalTotal + $intNetCarriage, 2, '.', '')."</b></td>
 		<td height='20'><b>".CURRENCY.number_format($intVatPayableTotal + $intVATCarriage, 2, '.', '')."</b></td>
		<td align='right'><b>".CURRENCY.number_format($intTotal, 2, '.', '')."</b></td>
    </tr>

	<tr>
		<td colspan='7' align='center'  height='70'>
			<h3>THIS SHEET FOR INTERNAL USE ONLY<br/>DO NOT SEND TO CUSTOMER</h3>
		</td>
	</tr>
	
	<tr valign='bottom'>
 		<td colspan='7' align='center' class='small'>
			".COMPANY_REGISTERED_ADDRESS."&nbsp;".VAT_NUMBER."
		</td>
    </tr>
	
</table>";

?>